package com.bawei.user

import android.graphics.Color
import androidx.cardview.widget.CardView
import com.bawei.base.bean.UserEntity
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

class UserAdapter:BaseQuickAdapter<UserEntity,BaseViewHolder>(R.layout.item_usercheck) {
    override fun convert(helper: BaseViewHolder, item: UserEntity) {
        val split = item.afternoonCheckIn.split(" ")
        helper.setText(R.id.check_time,"上班9：00 下班18：00")
        helper.setText(R.id.check_data,split[0])
        helper.setText(R.id.check_area,item.location)
        val view = helper.getView<CardView>(R.id.checkl_statubg)
        helper.setTextColor(R.id.checkl_statu,Color.WHITE)
        when(item.status){
            "1"->{
              view.setBackgroundResource(R.drawable.shape_text3)
                helper.setText(R.id.checkl_statu,"正常")
            }
            "2"->{
                view.setBackgroundResource(R.drawable.shape_text5)
                helper.setText(R.id.checkl_statu,"迟到")
            }
            "3"->{
                view.setBackgroundResource(R.drawable.shape_text1)
                helper.setText(R.id.checkl_statu,"早退")
            }
            "4"->{
                view.setBackgroundResource(R.drawable.shape_text4)
                helper.setText(R.id.checkl_statu,"缺勤")
            }

        }
    }
}